# Contributor: Cian Hughes <Ci@nHugh.es>
# Maintainer: Cian Hughes <Ci@nHugh.es>
pkgname=lirc
pkgver=0.10.2
pkgrel=1
pkgdesc="Infrared signal receiver and sender"
options="!check" # no tests
arch="all"
url="https://lirc.org/"
license="GPL-2.0-only"
makedepends="
	linux-headers
	bash
	python3
	py3-yaml
	py3-setuptools
	libtool
	autoconf
	automake
	libxslt
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-python-pyc $pkgname-python:python:noarch"
source="https://master.dl.sourceforge.net/project/lirc/LIRC/$pkgver/lirc-$pkgver.tar.gz
	0001-lirc.org-Remove-non-free-advertising.patch
	0002-lirc-setup-Fix-crash-on-start-on-missing-lirc.config.patch
	0008-fix-event-time-on-32bit.patch
	0010-lirc-add-include-for-major.patch
	"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--enable-devinput \
		--enable-uinput
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

python() {
	pkgdesc="Python3 bindings for lirc"
	depends=""

	amove usr/lib/python3*
	amove usr/share/lirc/python-pkg

	# This is a symlink to ../lib/python3.10/site-packages/lirc-setup/lirc-setup
	# if we don't move this symlink to the subpackage we have a recursive dep.
	amove usr/bin/lirc-setup
}

pyc() {
	default_pyc
	amove usr/share/lirc/python-pkg/__pycache__
}

sha512sums="
d4d2baf0c268162faa34947f8206df1fd1907fab29a9b8f83dc8852e03f837cc8dcb679cff436aa3aec52479ec579a3357d25bf0e6a83ff769d8eb2c60a12629  lirc-0.10.2.tar.gz
12ad8a6ad5d600ac9ebe65e3eb8d05b77745b1e8c4cc51924d8135994b9e0419765f3a16d692eeca5c1c525672be69975e6145be714b5b05a6f8b61677d3fbbf  0001-lirc.org-Remove-non-free-advertising.patch
9379c9c43fea67f67de59b64596e1c6937656bff74f9b5c4fe5de407eeeaf02552ea50fcbd85656899f268dc9b6c1d5de944b928bb8db303032442409dc5c2f4  0002-lirc-setup-Fix-crash-on-start-on-missing-lirc.config.patch
7e8d5e32d05b3cede9d4a0ab9e6873ef69f49dd325c6dc1522c72fb8aeb05bd370b4588723321346808e52b48e8422b8eb67930baeb28e0d58dbe18449dabfc7  0008-fix-event-time-on-32bit.patch
c4694a78a16a1831ea859719e27cfac1add6606b568e8d09d98dde9a14831bd921684a57ca9a433155abab0642f94c1be21b5b578d67b35ec98bbb14e2d944f7  0010-lirc-add-include-for-major.patch
"
